package com.jic.order.impl;

import java.lang.Long;
import java.util.List;


import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.order.entity.OrderAutomaticReceipted;
import com.jic.order.mapper.OrderAutomaticReceiptedMapper;
import com.jic.order.service.OrderAutomaticReceiptedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单自动签收表
 * @author : 
 * @email : 
 * @since : 2020-03-02 01:19:42
 * @version : v1.0.0
 */
@Service
public class OrderAutomaticReceiptedServiceImpl implements OrderAutomaticReceiptedService {

    @Autowired
    private OrderAutomaticReceiptedMapper orderAutomaticReceiptedMapper;

    @Override
    public long insert(OrderAutomaticReceipted orderAutomaticReceipted) {
        long flag = orderAutomaticReceiptedMapper.insert(orderAutomaticReceipted);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return orderAutomaticReceiptedMapper.delete(id);
    }

    @Override
    public long update(OrderAutomaticReceipted orderAutomaticReceipted) {
        return orderAutomaticReceiptedMapper.update(orderAutomaticReceipted);
    }

    @Override
    public OrderAutomaticReceipted queryByPrimaryKey(Long id){
        return orderAutomaticReceiptedMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<OrderAutomaticReceipted> query(OrderAutomaticReceipted orderAutomaticReceipted){
        return orderAutomaticReceiptedMapper.query(orderAutomaticReceipted);
    }

    @Override
    public PageResult<OrderAutomaticReceipted> queryPage(OrderAutomaticReceipted orderAutomaticReceipted, Page pageQuery) {
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<OrderAutomaticReceipted> list = orderAutomaticReceiptedMapper.queryPage(startIndex, pageQuery.getLimit(), orderAutomaticReceipted);
        long count = orderAutomaticReceiptedMapper.queryPageCount(orderAutomaticReceipted);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}